import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;

public class StartGame extends JFrame implements MouseListener {
    private static final Image backGroundImg;
    static {
        try {
            backGroundImg = ImageIO.read(new File(Static.Src_backGroundImg));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    public StartGame(){
        setTitle("人机对弈五子棋");
        //设置窗体大小
        setSize(Static.Win_W, Static.Win_H);
        //设置窗体颜色
//        getContentPane().setBackground(new Color(209, 146, 17));
        //窗体可见
        setVisible(true);
        //居中
        setLocationRelativeTo(null);
        //关闭即结束程序
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //禁止缩放
        setResizable(false);
        setFocusable(true);

        this.repaint();
        this.addMouseListener(this);
    }
    @Override
    public void mousePressed(MouseEvent e) {
        new CreatFrame();
        this.dispose();
    }

    @Override
    public void paint(Graphics g) {
        g.drawImage(backGroundImg, 0, 0, Static.Win_W, Static.Win_H, null);
    }

    @Override
    public void mouseClicked(MouseEvent e) {

    }



    @Override
    public void mouseReleased(MouseEvent e) {

    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }


}
